<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<title>动态</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui-win.css" />
	<link rel="stylesheet" type="text/css" href="../../css/pullToRefresh.css">
<style>
*{
	margin:0;
	padding:0;
}
a {
	text-decoration: none;
}
/*设置内容区样式*/
body {
	min-width: 320px;
	background:white !important;
}
#wrapper{
	background-color: #f2f2f2;
}
#wrapper ul li {
	overflow: hidden;
	border-bottom: 1px solid #d9d9d9;
}
#wrapper ul li a {
	display: block;
	overflow: hidden;
	position: relative;
}
#wrapper ul li a.active {
	background-color: #d9e4e9;
}
#wrapper ul li img {
	float: left;
	width: 40px;
	height: 40px;
	border-radius: 4px;
}
#wrapper .content {
	margin-left: 50px;
	overflow: hidden;
	height: 50px;
}
.logo{
	margin:10px;
}
#wrapper .content h2, #wrapper h2 {
	width: 80%;
	font-size: 16px;
	font-weight: 800;
	height: 25px;
	white-space: nowrap;
	text-overflow: ellipsis;
	line-height:25px;
	color:#333;
}

#wrapper .content span {
	font-size: 12px !important;
	    font-weight: normal
}
.title {
	width: 250px;
	height: 15px;
	overflow: hidden;
}
.time {
	position: absolute;
	font-size: 14px;
	right: 1%;
	overflow: hidden;
	color:#999;
}
.pullUpLabel{
}

.top_loding,.foot_loding{
	height: 40px;
	width: 100%;
	display: none;
	color: white;
	text-align: center;
	line-height: 40px;
	background:url(../../image/my/2.gif) no-repeat black;
	background-size:40px;
	background-position: 20% 3px;
	
}

</style>
<script src="../../script/iscroll.js"></script>
<script src="../../script/pullToRefresh.js"></script>
<script src="../../script/jquery-1.10.2.min.js"></script>
<script src="../../script/common.js"></script>
</head>
<body>

    <div class="div_loding_img" style="display:none;">
		数据加载中
	</div>
<header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
		<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back" > <span class="aui-iconfont aui-icon-left"></span></a>
		<div class="aui-title" id="title">
			动态
		</div>
		<a class="aui-iconfont aui-icon-menu aui-pull-right"> </a>
		
</header>
<div class="margin_div"></div>

<div id="wrapper" style="overflow:none;">
	<ul  id="txtNewsList">
		
	</ul>
</div>
<div class="foot_loding">
	加 载 中 ……
</div>
<script type="text/javascript">
//显示数据条数
var arr_data=new Array();
var pagesize=10;
//当前数量
var curCount = 0;
var baseparam;
var obj = $('#txtNewsList');
			
var logoStr = '';
baseparam=basedata('dyncinfo');
var Post;
getListData();
$("#back").click(function(){
     goback("../main.html");
});
function getListData(){
	Post =baseparam+"&pagesize="+pagesize+"&curCount="+curCount;
	arr_data=[];
	$(".div_loding_img").css("display","block")
	ajaxcocRequest('../../../api/group/getgroupdynamicinfolist', "post", Post, function(msg){
		if(msg.code ==100){
			if(msg.data.length==0){
				$(".div_loding_img").css("display","none")
				obj.html("<div style='width:20%;margin:40px 0 0 40%;'><img src='../../image/gantan.png' style='width:100%;'></div><p style='width:100%;text-align:center;margin-top:30px;color:#999;font-size:18px;'>没有任何信息！</p>");
				$(".pullUpLabel").css("color","#f5f5f5");
			}
			else{
			$('#txtNewsList').html("");
			var html = '';	
			curCount=curCount+msg['data'].length;
			for (var i = 0, len = msg['data'].length; i < len; i++) {
				var thisItem = msg['data'][i];
				var content = thisItem.n3;
				var dd = content.replace(/<\/?.+?>/g, "");
				var dds = dd.replace(/&nbsp;/g, "");
				var li  = document.createElement("li");
				//alert(thisItem.n1);
				if (thisItem.n1 != null) {
					logoStr = thisItem.n1;
				} else {
					logoStr = '../../image/home/busess/yunzo_def_dync.png';
				}
				html+='<li><a href="dync_info.html?'+encodeURIComponent("infoid="+msg.data[i].n0+"&title="+ msg.data[i].n2+"&desc="+dds.substring(0,30))+'"><div class="logo"><img src="' + logoStr + '"/><div class="content"><h2 class="title">' + thisItem.n2 + '<span class="time">' + thisItem.n4 + '</span></h2></div></div></a></li>'
				arr_data.push(msg.data[i].n0);
				
			}
			$(".div_loding_img").css("display","none")
			obj.html(html);
			}
			$("img").error(function(){
				$(this).attr("src","../../image/home/busess/yunzo_def_dync.png")
			})
    	}
		else{
		$(".div_loding_img").css("display","none")
			$("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
		}

	});
}
refresher.init({
	id:"wrapper",
	pullDownAction:Refresh,
	pullUpAction:Load
	});
		
var generatedCount = 0;
function Refresh() {
	window.history.go(0)
	wrapper.refresh();
}

function Load() {
	if(curCount==pagesize)
	{
		$(".div_loding_img").css("display","block");
		pagesize=pagesize+5;
		var post =baseparam+"&pagesize="+pagesize+"&curCount="+curCount;
	   	ajaxcocRequest('../../../api/group/getgroupdynamicinfolist', "post", post, function(msg){
			if(msg.code ==100){
					var strr="";
					var logoStrr="";
					for(var i=0;i<msg.data.length;i++){
						var tag=false;
						for(var j=0;j<arr_data.length;j++){
							if(msg.data[i].n0===arr_data[j]){
								tag=true;
								break;
							}
						}
						if(!tag){
							var content = msg.data[i].n3;
							var dd = content.replace(/<\/?.+?>/g, "");
							var dds = dd.replace(/&nbsp;/g, "");
							if (msg.data[i].n1 != "null") {
								logoStrr = msg.data[i].n1;
							} 
							else {
								logoStrr = '../../image/home/busess/yunzo_def_dync.png';
							}
							strr='<li><a href="dync_info.html?'+encodeURIComponent("infoid="+msg.data[i].n0+"&title="+ msg.data[i].n2+"&desc="+dds.substring(0,30))+'"><div class="logo"><img src="' + logoStrr + '"/><div class="content"><h2 class="title">' + msg.data[i].n2 + '<span class="time">' + msg.data[i].n4 + '</span></h2></div></div></a></li>'
							arr_data.push(msg.data[i].n0);
							$(".div_loding_img").css("display","none");
							obj.append(strr);
							wrapper.refresh();
							
						}
						
					}
					$("img").error(function(){
						$(this).attr("src","../../image/home/busess/yunzo_def_dync.png")
					})
					
					$(".foot_loding").css("display","none");
	
					wrapper.refresh();	
	
			}
			else{
				$("body").append('<div class="wuwang"><img src="../../image/iconfont-wangluo.png"><p>网络拥堵，信息塞车</p></div>')
			}
		});
	}else
	{
		$(".foot_loding").css("display","none");
	}
	
}
</script>
</body>
</html>